home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1990: Discy Business / Discy Business.2mg / DEV.CD / TOOLS / CLIBS / LIBRARIES / CINCLUDE / INTMATH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-01  |  5.4 KB  |  101 lines  |  [B0] Apple IIgs Source Code (0x000A)

  1. /********************************************
  2. ; File: IntMath.h
  3. ;
  4. ;
  5. ; Copyright Apple Computer, Inc. 1986, 1987, 1988
  6. ; All Rights Reserved
  7. ;
  8. ********************************************/
  9.  
  10. #ifndef __types__
  11. #include <types.h>
  12. #endif
  13.  
  14. #ifndef __intmath__
  15. #define __intmath__
  16.  
  17. #define  imBadInptParam 0x0B01   /*error - bad input parameter */
  18. #define  imIllegalChar  0x0B02   /*error - Illegal character in string */
  19. #define  imOverflow     0x0B03   /*error - integer or long integer overflow */
  20. #define  imStrOverflow  0x0B04   /*error - string overflow */
  21.  
  22. #define  minLongint 0x80000000 /*Limit - minimum negative signed long integer */
  23. #define  minFrac  0x80000000 /*Limit - pinned value for negative Frac overflow */
  24. #define  minFixed 0x80000000 /*Limit - pinned value for negative Fixed overflow */
  25. #define  minInt    0x8000  /*Limit - minimum negative signed integer */
  26. #define  maxInt    0x7FFF  /*Limit - maximum positive signed integer */
  27. #define  maxUInt   0xFFFF  /*Limit - maximum unsigned integer */
  28. #define  maxLongint 0x7FFFFFFF   /*Limit - maximum positive signed Longint */
  29. #define  maxFrac  0x7FFFFFFF  /*Limit - pinned value for positive Frac overflow */
  30. #define  maxFixed 0x7FFFFFFF  /*Limit - pinned value for positive Fixed overflow */
  31. #define  maxULong 0xFFFFFFFF  /*Limit - maximum unsigned Long */
  32.  
  33. #define  unsignedFlag 0x0000   /*SignedFlag -   */
  34. #define  signedFlag    0x0001  /*SignedFlag -   */
  35.  
  36. typedef struct LongDivRec  {
  37.       Longint     quotient;     /* LongDivRec - Quotient from LongDiv*/
  38.       Longint     remainder;     /* LongDivRec - remainder from LongDiv*/
  39.       } LongDivRec,  *LongDivRecPtr ;
  40.  
  41. typedef LongDivRec DivRec;   /* for compatibility w/previous releases  */  
  42.  
  43. typedef struct LongMulRec  {
  44.       Longint  lsResult; /* LongMulRec - Low Long of result*/
  45.       Longint  msResult;  /* LongMulRec - High long of result*/
  46.       } LongMulRec,  *LongMulRecPtr ;
  47.  
  48. typedef struct IntDivRec  {
  49.       Integer     quotient;     /* IntDivRec - quotient from SDivide*/
  50.       Integer     remainder;     /* IntDivRec - remainder from SDivide*/
  51.       } IntDivRec,  *IntDivRecPtr ;
  52.  
  53. typedef struct WordDivRec  {
  54.       Word     quotient;     /* WordDivRec - Quotient from UDivide*/
  55.       Word     remainder;     /* WordDivRec - remainder from UDivide*/
  56.       } WordDivRec,  *WordDivRecPtr ;
  57.      
  58. extern pascal void  IMBootInit() inline(0x010B,dispatcher);   /* Integer Math Tools */
  59. extern pascal void  IMStartUp() inline(0x020B,dispatcher);   /* Integer Math Tools */
  60. extern pascal void  IMShutDown() inline(0x030B,dispatcher);   /* Integer Math Tools */
  61. extern pascal Word  IMVersion() inline(0x040B,dispatcher);   /* Integer Math Tools */
  62. extern pascal void  IMReset() inline(0x050B,dispatcher);   /* Integer Math Tools */
  63. extern pascal Boolean  IMStatus() inline(0x060B,dispatcher);   /* Integer Math Tools */
  64.  
  65. extern pascal Integer  Dec2Int() inline(0x280B,dispatcher);   /* Integer Math Tools */
  66. extern pascal Longint  Dec2Long() inline(0x290B,dispatcher);   /* Integer Math Tools */
  67. extern pascal Frac  Fix2Frac() inline(0x1C0B,dispatcher);   /* Integer Math Tools */
  68. extern pascal Longint  Fix2Long() inline(0x1B0B,dispatcher);   /* Integer Math Tools */
  69. extern pascal void  Fix2X() inline(0x1E0B,dispatcher);   /* Integer Math Tools */
  70. extern pascal Fixed  FixATan2() inline(0x170B,dispatcher);   /* Integer Math Tools */
  71. extern pascal Fixed  FixDiv() inline(0x110B,dispatcher);   /* Integer Math Tools */
  72. extern pascal Fixed  FixMul() inline(0x0F0B,dispatcher);   /* Integer Math Tools */
  73. extern pascal Fixed  FixRatio() inline(0x0E0B,dispatcher);   /* Integer Math Tools */
  74. extern pascal Integer  FixRound() inline(0x130B,dispatcher);   /* Integer Math Tools */
  75. extern pascal Fixed  Frac2Fix() inline(0x1D0B,dispatcher);   /* Integer Math Tools */
  76. extern pascal void  Frac2X() inline(0x1F0B,dispatcher);   /* Integer Math Tools */
  77. extern pascal Frac  FracCos() inline(0x150B,dispatcher);   /* Integer Math Tools */
  78. extern pascal Frac  FracDiv() inline(0x120B,dispatcher);   /* Integer Math Tools */
  79. extern pascal Frac  FracMul() inline(0x100B,dispatcher);   /* Integer Math Tools */
  80. extern pascal Frac  FracSin() inline(0x160B,dispatcher);   /* Integer Math Tools */
  81. extern pascal Frac  FracSqrt() inline(0x140B,dispatcher);   /* Integer Math Tools */
  82. extern pascal Word  Hex2Int() inline(0x240B,dispatcher);   /* Integer Math Tools */
  83. extern pascal LongWord  Hex2Long() inline(0x250B,dispatcher);   /* Integer Math Tools */
  84. extern pascal LongWord  HexIt() inline(0x2A0B,dispatcher);   /* Integer Math Tools */
  85. extern pascal Word  HiWord() inline(0x180B,dispatcher);   /* Integer Math Tools */
  86. extern pascal void  Int2Dec() inline(0x260B,dispatcher);   /* Integer Math Tools */
  87. extern pascal void  Int2Hex() inline(0x220B,dispatcher);   /* Integer Math Tools */
  88. extern pascal void  Long2Dec() inline(0x270B,dispatcher);   /* Integer Math Tools */
  89. extern pascal Fixed  Long2Fix() inline(0x1A0B,dispatcher);   /* Integer Math Tools */
  90. extern pascal void  Long2Hex() inline(0x230B,dispatcher);   /* Integer Math Tools */
  91. extern LongDivRec LongDivide();
  92. extern LongMulRec LongMul();
  93. extern pascal Word  LoWord() inline(0x190B,dispatcher);   /* Integer Math Tools */
  94. extern pascal Longint  Multiply() inline(0x090B,dispatcher);   /* Integer Math Tools */
  95. extern IntDivRec SDivide();
  96. extern WordDivRec UDivide();
  97. extern pascal Longint  X2Fix() inline(0x200B,dispatcher);   /* Integer Math Tools */
  98. extern pascal Longint  X2Frac() inline(0x210B,dispatcher);   /* Integer Math Tools */
  99.  
  100. #endif
  101.